PopupMenu

constructor(@NonNull context: @NonNull Context, @NonNull anchor: @NonNull View)(source)

Constructor to create a new popup menu with an anchor view.

Parameters

context

Context the popup menu is running in, through which it can access the current theme, resources, etc.

anchor

Anchor view for this popup. The popup will appear below the anchor if there is room, or above it if there is not.


constructor(@NonNull context: @NonNull Context, @NonNull anchor: @NonNull View, gravity: Int)(source)

Constructor to create a new popup menu with an anchor view and alignment gravity.

Parameters

context

Context the popup menu is running in, through which it can access the current theme, resources, etc.

anchor

Anchor view for this popup. The popup will appear below the anchor if there is room, or above it if there is not.

gravity

The Gravity value for aligning the popup with its anchor.


constructor(@NonNull context: @NonNull Context, @NonNull anchor: @NonNull View, gravity: Int, @AttrRes popupStyleAttr: Int, @StyleRes popupStyleRes: Int)(source)

Constructor a create a new popup menu with a specific style.

Parameters

context

Context the popup menu is running in, through which it can access the current theme, resources, etc.

anchor

Anchor view for this popup. The popup will appear below the anchor if there is room, or above it if there is not.

gravity

The Gravity value for aligning the popup with its anchor.

popupStyleAttr

An attribute in the current theme that contains a reference to a style resource that supplies default values for the popup window. Can be 0 to not look for defaults.

popupStyleRes

A resource identifier of a style resource that supplies default values for the popup window, used only if popupStyleAttr is 0 or can not be found in the theme. Can be 0 to not look for defaults.